package main

import (
	"database/sql"
	"fmt"
	"gin-demo/database"
	"github.com/gin-gonic/gin"
	"net/http"
)

var (
	db *sql.DB
)

//go mod tidy // 重新登记依赖
func main() {
	var err interface{}
	err, db = database.InitDB()
	//db.Prepare("") // 预处理
	if err != nil {
		fmt.Println("错误")
	}
	r := gin.Default()

	// 注册路由
	r.GET("/", func(c *gin.Context) {
		c.String(http.StatusOK, "ok")
		_, _ = db.Query("select * from yunzhu", 1)
	})

	r.Run()
}
